<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="utf-8" />
    
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
  <title>
    CSS3-3D&amp;animation.md |  Small Bridge
  </title>
  <meta name="generator" content="hexo-theme-yilia-plus">
  
  <link rel="shortcut icon" href="/favicon.ico" />
  
  
<link rel="stylesheet" href="/css/main.css">

  
  <script src="https://cdn.jsdelivr.net/npm/pace-js@1.0.2/pace.min.js"></script>
  
  

  

<link rel="alternate" href="/atom.xml" title="Small Bridge" type="application/atom+xml">
</head>

</html>

<body>
  <div id="app">
    <main class="content">
      <section class="outer">
  <article id="post-CSS3-3D-animation-md" class="article article-type-post" itemscope
  itemprop="blogPost" data-scroll-reveal>

  <div class="article-inner">
    
    <header class="article-header">
       
<h1 class="article-title sea-center" style="border-left:0" itemprop="name">
  CSS3-3D&amp;animation.md
</h1>
  

    </header>
    

    
    <div class="article-meta">
      <a href="/2020/05/14/CSS3-3D-animation-md/" class="article-date">
  <time datetime="2020-05-14T13:26:43.000Z" itemprop="datePublished">2020-05-14</time>
</a>
      
  <div class="article-category">
    <a class="article-category-link" href="/categories/CSS/">CSS</a>
  </div>

      
      
<div class="word_count">
    <span class="post-time">
        <span class="post-meta-item-icon">
            <i class="ri-quill-pen-line"></i>
            <span class="post-meta-item-text"> 字数统计:</span>
            <span class="post-count">3.3k字</span>
        </span>
    </span>

    <span class="post-time">
        &nbsp; | &nbsp;
        <span class="post-meta-item-icon">
            <i class="ri-book-open-line"></i>
            <span class="post-meta-item-text"> 阅读时长≈</span>
            <span class="post-count">17分钟</span>
        </span>
    </span>
</div>

      
    </div>
    

    
    
    <div class="tocbot"></div>





    

    
    <div class="article-entry" itemprop="articleBody">
      


      

      
      <p>@<a href="CSS3">TOC</a></p>
<a id="more"></a>
<h1 id="3D坐标轴"><a href="#3D坐标轴" class="headerlink" title="3D坐标轴"></a>3D坐标轴</h1><p>前端中的3D坐标轴和我们印象中的有点不一样，我们可以这样记，屏幕水平(左右)方向为X轴，垂直(上下)方向为Y轴，面向穿过你自己为Z轴，我是这样记的，感觉比较好记</p>
<h1 id="景深，舞台，灭点和景深基点"><a href="#景深，舞台，灭点和景深基点" class="headerlink" title="景深，舞台，灭点和景深基点"></a>景深，舞台，灭点和景深基点</h1><p>要在前端页面上实现3D效果，我们必须明确以下几个概念</p>
<p>景深(perspective)：是指相机对焦点前后相对清晰的成像范围<br>太抽象了，简单的理解就是我们肉眼离显示器的距离，景深越大，元素离我们越近，效果越不好，景深作用于所有后代元素，并且景深会叠加</p>
<p>舞台(transform-style)：应用景深的元素称为”舞台元素”，舞台元素的所有后代元素都会受影响,作用在于营造有层级的3D舞台，不可继承</p>
<p>灭点：指的是立体图形两边的延伸线所产生的相交点，透视点的消失点。<br>百度的图片，看一下吧<br><img src="https://img-blog.csdnimg.cn/20200502153606816.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQ0NjI1MTQy,size_16,color_FFFFFF,t_70" alt="在这里插入图片描述"><br>我们只需要知道，景深越大，灭点越远，元素变形越不明显,反之亦然</p>
<p>景深基点(perspective-origin)：用来控制视角的位置，简单来说就是你眼睛的位置</p>
<p>backface-visibility属性:用于设置元素背面是否为可见</p>
<h1 id="3D变换"><a href="#3D变换" class="headerlink" title="3D变换"></a>3D变换</h1><p>同2D的基本一致，就是多了一个Z轴的变换</p>
<ol>
<li><p>3D旋转<br>roateX(角度)   rotateY()  rotateZ()<br>rotate3d(x,y,z) 按照原点到点(x,y,z)的射线转</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br></pre></td><td class="code"><pre><span class="line">&lt;!DOCTYPE html&gt;</span><br><span class="line">&lt;html&gt;</span><br><span class="line">	&lt;head&gt;</span><br><span class="line">		&lt;meta charset=<span class="string">"utf-8"</span>&gt;</span><br><span class="line">		&lt;title&gt;&lt;<span class="regexp">/title&gt;</span></span><br><span class="line"><span class="regexp">		&lt;style type="text/</span>css<span class="string">"&gt;</span></span><br><span class="line"><span class="string">			*&#123;</span></span><br><span class="line"><span class="string">				margin: 0;</span></span><br><span class="line"><span class="string">				padding: 0;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			html,body&#123;</span></span><br><span class="line"><span class="string">				height: 100%;</span></span><br><span class="line"><span class="string">				overflow: hidden;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			#wrap&#123;</span></span><br><span class="line"><span class="string">				width: 400px;</span></span><br><span class="line"><span class="string">				height: 400px;</span></span><br><span class="line"><span class="string">				border: 1px solid;</span></span><br><span class="line"><span class="string">				position: absolute;</span></span><br><span class="line"><span class="string">				left: 50%;</span></span><br><span class="line"><span class="string">				top: 50%;</span></span><br><span class="line"><span class="string">				margin-top: -200px;</span></span><br><span class="line"><span class="string">				margin-left: -200px;</span></span><br><span class="line"><span class="string">				perspective: 120px;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			#inner&#123;</span></span><br><span class="line"><span class="string">				width: 200px;</span></span><br><span class="line"><span class="string">				height: 200px;</span></span><br><span class="line"><span class="string">				background: pink;</span></span><br><span class="line"><span class="string">				border: 1px solid;</span></span><br><span class="line"><span class="string">				border-radius: 50%;</span></span><br><span class="line"><span class="string">				position: absolute;</span></span><br><span class="line"><span class="string">				left: 50%;</span></span><br><span class="line"><span class="string">				top: 50%;</span></span><br><span class="line"><span class="string">				margin-top: -100px;</span></span><br><span class="line"><span class="string">				margin-left: -100px;</span></span><br><span class="line"><span class="string">				text-align: center;</span></span><br><span class="line"><span class="string">				font: 30px/200px "</span>微软雅黑<span class="string">";</span></span><br><span class="line"><span class="string">				transition: 2s;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			#wrap:hover&gt;#inner&#123;</span></span><br><span class="line"><span class="string">				/* transform: rotateY(360deg); */</span></span><br><span class="line"><span class="string">				transform: rotate3d(1,1,1,360deg);</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">		&lt;/style&gt;</span></span><br><span class="line"><span class="string">	&lt;/head&gt;</span></span><br><span class="line"><span class="string">	&lt;body&gt;</span></span><br><span class="line"><span class="string">		&lt;div id="</span>wrap<span class="string">"&gt;</span></span><br><span class="line"><span class="string">			&lt;div id="</span>inner<span class="string">"&gt;</span></span><br><span class="line"><span class="string">			月下Ctrlc</span></span><br><span class="line"><span class="string">		&lt;/div&gt;</span></span><br><span class="line"><span class="string">		&lt;/div&gt;</span></span><br><span class="line"><span class="string">	&lt;/body&gt;</span></span><br><span class="line"><span class="string">&lt;/html&gt;</span></span><br></pre></td></tr></table></figure></li>
<li><p>3D平移<br>translateX()  translateY()  translateZ()<br>translate3d(x,y,z)  z轴上偏移量不能写百分比，因为元素没有厚度<br>例子 就在上面那个例子的基础上改就行了</p>
</li>
<li><p>3D缩放<br>scaleZ()  意义在影响Z轴上的平移,一个东西离你近了看起来就大了<br>scaleZ(2) translateZ(100px) 就相当于 translateZ(200px)<br>scale3d(x,y,z)<br>例子自己对应修改吧</p>
<h1 id="3D实例"><a href="#3D实例" class="headerlink" title="3D实例"></a>3D实例</h1></li>
<li><p>立方体(第一种实现)<br>先展开,后旋转</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br></pre></td><td class="code"><pre><span class="line">&lt;!DOCTYPE html&gt;</span><br><span class="line">&lt;html&gt;</span><br><span class="line">	&lt;head&gt;</span><br><span class="line">		&lt;meta charset=<span class="string">"utf-8"</span>&gt;</span><br><span class="line">		&lt;title&gt;&lt;<span class="regexp">/title&gt;</span></span><br><span class="line"><span class="regexp">		&lt;style type="text/</span>css<span class="string">"&gt;</span></span><br><span class="line"><span class="string">			*&#123;</span></span><br><span class="line"><span class="string">				margin: 0;</span></span><br><span class="line"><span class="string">				padding: 0;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			#wrap&#123;</span></span><br><span class="line"><span class="string">				width: 400px;</span></span><br><span class="line"><span class="string">				height: 400px;</span></span><br><span class="line"><span class="string">				position: absolute;</span></span><br><span class="line"><span class="string">				top: 0;</span></span><br><span class="line"><span class="string">				right: 0;</span></span><br><span class="line"><span class="string">				bottom: 0;</span></span><br><span class="line"><span class="string">				left: 0;</span></span><br><span class="line"><span class="string">				margin: auto;</span></span><br><span class="line"><span class="string">				border: 1px solid;</span></span><br><span class="line"><span class="string">				perspective: 100px;</span></span><br><span class="line"><span class="string">				transform-style: preserve-3d;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			#wrap&gt;.box&#123;</span></span><br><span class="line"><span class="string">				width: 100px;</span></span><br><span class="line"><span class="string">				height: 100px;</span></span><br><span class="line"><span class="string">				position: absolute;</span></span><br><span class="line"><span class="string">				left: 50%;</span></span><br><span class="line"><span class="string">				top: 50%;</span></span><br><span class="line"><span class="string">				margin-top: -50px;</span></span><br><span class="line"><span class="string">				margin-left: -50px;</span></span><br><span class="line"><span class="string">				text-align: center;</span></span><br><span class="line"><span class="string">				font: 50px/100px "</span>微软雅黑<span class="string">";</span></span><br><span class="line"><span class="string">				transform-style: preserve-3d;</span></span><br><span class="line"><span class="string">				transform-origin: center center -50px;</span></span><br><span class="line"><span class="string">				transition: 3s;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			#wrap&gt;.box&gt;div&#123;</span></span><br><span class="line"><span class="string">				width: 100px;</span></span><br><span class="line"><span class="string">				height: 100px;</span></span><br><span class="line"><span class="string">				background: pink;</span></span><br><span class="line"><span class="string">				position: absolute;</span></span><br><span class="line"><span class="string">				border-radius: 50%;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			#wrap&gt;.box&gt;div:nth-child(5)&#123;</span></span><br><span class="line"><span class="string">				top: -100px;</span></span><br><span class="line"><span class="string">				transform-origin: bottom;</span></span><br><span class="line"><span class="string">				transform: rotateX(90deg);</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			#wrap&gt;.box&gt;div:nth-child(6)&#123;</span></span><br><span class="line"><span class="string">				bottom: -100px;</span></span><br><span class="line"><span class="string">				transform-origin: top;</span></span><br><span class="line"><span class="string">				transform: rotateX(-90deg);</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			#wrap&gt;.box&gt;div:nth-child(3)&#123;</span></span><br><span class="line"><span class="string">				left: -100px;</span></span><br><span class="line"><span class="string">				transform-origin: right;</span></span><br><span class="line"><span class="string">				transform: rotateY(-90deg);</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			#wrap&gt;.box&gt;div:nth-child(4)&#123;</span></span><br><span class="line"><span class="string">				right: -100px;</span></span><br><span class="line"><span class="string">				transform-origin: left;</span></span><br><span class="line"><span class="string">				transform: rotateY(90deg);</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			#wrap&gt;.box&gt;div:nth-child(2)&#123;</span></span><br><span class="line"><span class="string">				transform: translateZ(-100px) rotateX(180deg);</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			#wrap&gt;.box&gt;div:nth-child(1)&#123;</span></span><br><span class="line"><span class="string">				z-index: 1;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			#wrap:hover&gt;.box&#123;</span></span><br><span class="line"><span class="string">				transform: rotateX(360deg);</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">		&lt;/style&gt;</span></span><br><span class="line"><span class="string">	&lt;/head&gt;</span></span><br><span class="line"><span class="string">	&lt;body&gt;</span></span><br><span class="line"><span class="string">		&lt;div id="</span>wrap<span class="string">"&gt;</span></span><br><span class="line"><span class="string">			&lt;div class="</span>box<span class="string">"&gt;</span></span><br><span class="line"><span class="string">				&lt;div&gt;前&lt;/div&gt;</span></span><br><span class="line"><span class="string">				&lt;div&gt;后&lt;/div&gt;</span></span><br><span class="line"><span class="string">				&lt;div&gt;左&lt;/div&gt;</span></span><br><span class="line"><span class="string">				&lt;div&gt;右&lt;/div&gt;</span></span><br><span class="line"><span class="string">				&lt;div&gt;上&lt;/div&gt;</span></span><br><span class="line"><span class="string">				&lt;div&gt;下&lt;/div&gt;</span></span><br><span class="line"><span class="string">			&lt;/div&gt;</span></span><br><span class="line"><span class="string">		&lt;/div&gt;</span></span><br><span class="line"><span class="string">	&lt;/body&gt;</span></span><br><span class="line"><span class="string">&lt;/html&gt;</span></span><br></pre></td></tr></table></figure>
</li>
<li><p>立方体(第二种实现)<br>直接旋转</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br></pre></td><td class="code"><pre><span class="line">&lt;!DOCTYPE html&gt;</span><br><span class="line">&lt;html&gt;</span><br><span class="line">	&lt;head&gt;</span><br><span class="line">		&lt;meta charset=<span class="string">"utf-8"</span>&gt;</span><br><span class="line">		&lt;title&gt;&lt;<span class="regexp">/title&gt;</span></span><br><span class="line"><span class="regexp">		&lt;style type="text/</span>css<span class="string">"&gt;</span></span><br><span class="line"><span class="string">			*&#123;</span></span><br><span class="line"><span class="string">				margin: 0;</span></span><br><span class="line"><span class="string">				padding: 0;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			#wrap&#123;</span></span><br><span class="line"><span class="string">				width: 400px;</span></span><br><span class="line"><span class="string">				height: 400px;</span></span><br><span class="line"><span class="string">				position: absolute;</span></span><br><span class="line"><span class="string">				top: 0;</span></span><br><span class="line"><span class="string">				right: 0;</span></span><br><span class="line"><span class="string">				bottom: 0;</span></span><br><span class="line"><span class="string">				left: 0;</span></span><br><span class="line"><span class="string">				margin: auto;</span></span><br><span class="line"><span class="string">				border: 1px solid;</span></span><br><span class="line"><span class="string">				perspective: 100px;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			#wrap&gt;.box&#123;</span></span><br><span class="line"><span class="string">				width: 100px;</span></span><br><span class="line"><span class="string">				height: 100px;</span></span><br><span class="line"><span class="string">				position: absolute;</span></span><br><span class="line"><span class="string">				left: 50%;</span></span><br><span class="line"><span class="string">				top: 50%;</span></span><br><span class="line"><span class="string">				margin-top: -50px;</span></span><br><span class="line"><span class="string">				margin-left: -50px;</span></span><br><span class="line"><span class="string">				text-align: center;</span></span><br><span class="line"><span class="string">				font: 50px/100px "</span>微软雅黑<span class="string">";</span></span><br><span class="line"><span class="string">				transform-style: preserve-3d;</span></span><br><span class="line"><span class="string">				transform-origin: center center -50px;</span></span><br><span class="line"><span class="string">				transition: 3s;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			#wrap&gt;.box&gt;div&#123;</span></span><br><span class="line"><span class="string">				width: 100px;</span></span><br><span class="line"><span class="string">				height: 100px;</span></span><br><span class="line"><span class="string">				background: pink;</span></span><br><span class="line"><span class="string">				position: absolute;</span></span><br><span class="line"><span class="string">				transform-origin: center center -50px;</span></span><br><span class="line"><span class="string">				/* 设置背面为不可见 */</span></span><br><span class="line"><span class="string">				backface-visibility: hidden;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			#wrap&gt;.box&gt;div:nth-child(5)&#123;</span></span><br><span class="line"><span class="string">				transform: rotateX(90deg);</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			#wrap&gt;.box&gt;div:nth-child(6)&#123;</span></span><br><span class="line"><span class="string">				transform: rotateX(270deg);</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			#wrap&gt;.box&gt;div:nth-child(4)&#123;</span></span><br><span class="line"><span class="string">				transform: rotateY(90deg);</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			#wrap&gt;.box&gt;div:nth-child(3)&#123;</span></span><br><span class="line"><span class="string">				transform: rotateY(270deg);</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			#wrap&gt;.box&gt;div:nth-child(2)&#123;</span></span><br><span class="line"><span class="string">				transform: rotateY(180deg) rotate(180deg);</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			#wrap&gt;.box&gt;div:nth-child(1)&#123;</span></span><br><span class="line"><span class="string">				</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			#wrap:hover&gt;.box&#123;</span></span><br><span class="line"><span class="string">				transform: rotateX(360deg);</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">		&lt;/style&gt;</span></span><br><span class="line"><span class="string">	&lt;/head&gt;</span></span><br><span class="line"><span class="string">	&lt;body&gt;</span></span><br><span class="line"><span class="string">		&lt;div id="</span>wrap<span class="string">"&gt;</span></span><br><span class="line"><span class="string">			&lt;div class="</span>box<span class="string">"&gt;</span></span><br><span class="line"><span class="string">				&lt;div&gt;前&lt;/div&gt;</span></span><br><span class="line"><span class="string">				&lt;div&gt;后&lt;/div&gt;</span></span><br><span class="line"><span class="string">				&lt;div&gt;左&lt;/div&gt;</span></span><br><span class="line"><span class="string">				&lt;div&gt;右&lt;/div&gt;</span></span><br><span class="line"><span class="string">				&lt;div&gt;上&lt;/div&gt;</span></span><br><span class="line"><span class="string">				&lt;div&gt;下&lt;/div&gt;</span></span><br><span class="line"><span class="string">			&lt;/div&gt;</span></span><br><span class="line"><span class="string">		&lt;/div&gt;</span></span><br><span class="line"><span class="string">	&lt;/body&gt;</span></span><br><span class="line"><span class="string">&lt;/html&gt;</span></span><br></pre></td></tr></table></figure>
</li>
<li><p>多棱柱(封装成函数)</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br></pre></td><td class="code"><pre><span class="line">&lt;!DOCTYPE html&gt;</span><br><span class="line">&lt;html&gt;</span><br><span class="line">	&lt;head&gt;</span><br><span class="line">		&lt;meta charset=<span class="string">"utf-8"</span>&gt;</span><br><span class="line">		&lt;title&gt;&lt;<span class="regexp">/title&gt;</span></span><br><span class="line"><span class="regexp">		&lt;style type="text/</span>css<span class="string">"&gt;</span></span><br><span class="line"><span class="string">			*&#123;</span></span><br><span class="line"><span class="string">				margin: 0;</span></span><br><span class="line"><span class="string">				padding: 0;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			html,body&#123;</span></span><br><span class="line"><span class="string">				height: 100%;</span></span><br><span class="line"><span class="string">				overflow: hidden;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			#wrap&#123;</span></span><br><span class="line"><span class="string">				width: 400px;</span></span><br><span class="line"><span class="string">				height: 400px;</span></span><br><span class="line"><span class="string">				position: absolute;</span></span><br><span class="line"><span class="string">				top: 0;</span></span><br><span class="line"><span class="string">				right: 0;</span></span><br><span class="line"><span class="string">				bottom: 0;</span></span><br><span class="line"><span class="string">				left: 0;</span></span><br><span class="line"><span class="string">				margin: auto;</span></span><br><span class="line"><span class="string">				border: 1px solid;</span></span><br><span class="line"><span class="string">				perspective: 500px;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			#wrap&gt;.box&#123;</span></span><br><span class="line"><span class="string">				/* 这里可以改变宽度，获取不同宽度的棱柱 */</span></span><br><span class="line"><span class="string">				/* 记得下面的居中也要改一下 */</span></span><br><span class="line"><span class="string">				width: 300px;</span></span><br><span class="line"><span class="string">				height: 300px;</span></span><br><span class="line"><span class="string">				position: absolute;</span></span><br><span class="line"><span class="string">				left: 50%;</span></span><br><span class="line"><span class="string">				top: 50%;</span></span><br><span class="line"><span class="string">				margin-top: -150px;</span></span><br><span class="line"><span class="string">				margin-left: -150px;</span></span><br><span class="line"><span class="string">				text-align: center;</span></span><br><span class="line"><span class="string">				font: 50px/300px "</span>微软雅黑<span class="string">";</span></span><br><span class="line"><span class="string">				transform-style: preserve-3d;</span></span><br><span class="line"><span class="string">				/* 过渡只给transform，不然基点也会过渡，出现不好的效果,打你脸上 */</span></span><br><span class="line"><span class="string">				transition: transform 3s;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			#wrap&gt;.box&gt;div&#123;</span></span><br><span class="line"><span class="string">				width: 100%;</span></span><br><span class="line"><span class="string">				height: 100%;</span></span><br><span class="line"><span class="string">				background: pink;</span></span><br><span class="line"><span class="string">				position: absolute;</span></span><br><span class="line"><span class="string">				/* 设置背面为不可见 */</span></span><br><span class="line"><span class="string">				backface-visibility: hidden;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			#wrap:hover&gt;.box&#123;</span></span><br><span class="line"><span class="string">				transform: rotateY(360deg);</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">		&lt;/style&gt;</span></span><br><span class="line"><span class="string">	&lt;/head&gt;</span></span><br><span class="line"><span class="string">	&lt;body&gt;</span></span><br><span class="line"><span class="string">		&lt;div id="</span>wrap<span class="string">"&gt;</span></span><br><span class="line"><span class="string">			&lt;div class="</span>box<span class="string">"&gt;&lt;/div&gt;</span></span><br><span class="line"><span class="string">		&lt;/div&gt;</span></span><br><span class="line"><span class="string">	&lt;/body&gt;</span></span><br><span class="line"><span class="string">	&lt;script type="</span>text/javascript<span class="string">"&gt;</span></span><br><span class="line"><span class="string">		window.onload = function()&#123;</span></span><br><span class="line"><span class="string">			createLZ(10);</span></span><br><span class="line"><span class="string">		&#125;</span></span><br><span class="line"><span class="string">		function createLZ(n)&#123;</span></span><br><span class="line">			var boxNode = document.querySelector("#wrap&gt;.box");</span><br><span class="line">			<span class="keyword">var</span> styleNode = <span class="built_in">document</span>.createElement(<span class="string">"style"</span>);</span><br><span class="line">			<span class="keyword">var</span> degOut = <span class="number">360</span> / n;         <span class="comment">//外角</span></span><br><span class="line">			<span class="keyword">var</span> degIn = <span class="number">180</span> - <span class="number">360</span>/n;      <span class="comment">//内角</span></span><br><span class="line">			<span class="keyword">var</span> length = boxNode.offsetWidth;</span><br><span class="line">			<span class="keyword">var</span> divHTML = <span class="string">""</span>;</span><br><span class="line">			<span class="keyword">var</span> cssHTML = <span class="string">""</span>;</span><br><span class="line">			<span class="keyword">for</span>(<span class="keyword">let</span> i = <span class="number">0</span>; i &lt; n; i++)&#123;</span><br><span class="line">				divHTML += <span class="string">`&lt;div&gt;<span class="subst">$&#123;i+<span class="number">1</span>&#125;</span>&lt;/div&gt;`</span>;</span><br><span class="line">				cssHTML += <span class="string">`#wrap&gt;.box&gt;div:nth-child(<span class="subst">$&#123;i+<span class="number">1</span>&#125;</span>)&#123;transform: rotateY(<span class="subst">$&#123;i*degOut&#125;</span>deg)&#125;`</span>;</span><br><span class="line">			&#125;</span><br><span class="line">			cssHTML += <span class="string">`#wrap&gt;.box&#123;transform-origin: center center <span class="subst">$&#123;-(length<span class="regexp">/2)*Math.tan(degIn*Math.PI/</span><span class="number">360</span>)&#125;</span>px;&#125;`</span>;</span><br><span class="line">			cssHTML += <span class="string">`#wrap&gt;.box&gt;div&#123;transform-origin: center center <span class="subst">$&#123;-(length<span class="regexp">/2)*Math.tan(degIn*Math.PI/</span><span class="number">360</span>)&#125;</span>px;&#125;`</span>;</span><br><span class="line">			boxNode.innerHTML = divHTML;</span><br><span class="line">			styleNode.innerHTML = cssHTML;</span><br><span class="line">			<span class="built_in">document</span>.head.appendChild(styleNode);</span><br><span class="line">		&#125;</span><br><span class="line">	&lt;<span class="regexp">/script&gt;</span></span><br><span class="line"><span class="regexp">&lt;/</span>html&gt;</span><br></pre></td></tr></table></figure>
<h1 id="动画"><a href="#动画" class="headerlink" title="动画"></a>动画</h1></li>
<li><p>API</p>
</li>
<li><p>1 动画内的属性<br>animation-name  指定动画的名称,默认值为none，表示无关键帧<br>animation-duration 指定一个动画的执行周期,默认为0，负值无效，低版本的浏览器会将负值解析为0<br>animation-timing-function 运动形式,可以指定贝塞尔函数，我讲不清楚，大家自己百度吧，贝赛尔<br>animation-direction 运动的方向，指定参数为reverse的时候，反转的是关键帧和运动形式</p>
</li>
<li><p>动画外的属性</p>
</li>
<li><p>1 animation-delay：指定动画开始之前的延迟</p>
</li>
<li><p>imation-iteration-count 指定动画的执行次数，动画内的范畴，不影响动画外的属性，重复的是关键帧</p>
</li>
<li><p>animation-fill-mode 确定元素在动画外的状态<br>动画外的状态指的是from之前to之后<br>参数:<br>backwards   from之前的状态与from的状态保持一致<br>forwards      to之后的状态与to的状态保持一致<br>both             backwards和forwards两者加起来的效果</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br></pre></td><td class="code"><pre><span class="line">&lt;!DOCTYPE html&gt;</span><br><span class="line">&lt;html&gt;</span><br><span class="line">	&lt;head&gt;</span><br><span class="line">		&lt;meta charset=<span class="string">"utf-8"</span>&gt;</span><br><span class="line">		&lt;title&gt;&lt;<span class="regexp">/title&gt;</span></span><br><span class="line"><span class="regexp">		&lt;style type="text/</span>css<span class="string">"&gt;</span></span><br><span class="line"><span class="string">			*&#123;</span></span><br><span class="line"><span class="string">				margin: 0;</span></span><br><span class="line"><span class="string">				padding: 0;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			#wrap&#123;</span></span><br><span class="line"><span class="string">				position: absolute;</span></span><br><span class="line"><span class="string">				width: 300px;</span></span><br><span class="line"><span class="string">				height: 300px;</span></span><br><span class="line"><span class="string">				border: 1px solid;</span></span><br><span class="line"><span class="string">				top: 0;</span></span><br><span class="line"><span class="string">				right: 0;</span></span><br><span class="line"><span class="string">				bottom: 0;</span></span><br><span class="line"><span class="string">				left: 0;</span></span><br><span class="line"><span class="string">				margin: auto;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			#wrap&gt;.inner&#123;</span></span><br><span class="line"><span class="string">				position: absolute;</span></span><br><span class="line"><span class="string">				left: 50%;</span></span><br><span class="line"><span class="string">				top: 50%;</span></span><br><span class="line"><span class="string">				margin-left: -50px;</span></span><br><span class="line"><span class="string">				margin-top: -50px;</span></span><br><span class="line"><span class="string">				height: 100px;</span></span><br><span class="line"><span class="string">				width: 100px;</span></span><br><span class="line"><span class="string">				background: pink;</span></span><br><span class="line"><span class="string">				text-align: center;</span></span><br><span class="line"><span class="string">				font: 20px/100px "</span>微软雅黑<span class="string">";</span></span><br><span class="line"><span class="string">				</span></span><br><span class="line"><span class="string">				</span></span><br><span class="line"><span class="string">				animation-name: move;</span></span><br><span class="line"><span class="string">				animation-duration: 2s;</span></span><br><span class="line"><span class="string">				animation-timing-function: linear;</span></span><br><span class="line"><span class="string">				animation-direction: normal;</span></span><br><span class="line"><span class="string">				animation-delay: 3s;</span></span><br><span class="line"><span class="string">				animation-iteration-count: 3;</span></span><br><span class="line"><span class="string">				</span></span><br><span class="line"><span class="string">				/* 确定元素在动画外的状态 */</span></span><br><span class="line"><span class="string">				/* 动画外的状态指的是from之前to之后 */</span></span><br><span class="line"><span class="string">				/* </span></span><br><span class="line"><span class="string">				 backwards: from之前的状态与form的状态保持一致</span></span><br><span class="line"><span class="string">				 forwards: to之后的状态与to的状态保持一致</span></span><br><span class="line"><span class="string">				 both: 两者都保持</span></span><br><span class="line"><span class="string">				 */</span></span><br><span class="line"><span class="string">				animation-fill-mode: both;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			</span></span><br><span class="line"><span class="string">			@keyframes move&#123;</span></span><br><span class="line"><span class="string">				from&#123;transform: translateY(-100px);&#125;</span></span><br><span class="line"><span class="string">				to&#123;transform: translateY(100px);&#125;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			#wrap:hover&gt;.inner&#123;</span></span><br><span class="line"><span class="string">				animation-play-state: paused;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">		&lt;/style&gt;</span></span><br><span class="line"><span class="string">	&lt;/head&gt;</span></span><br><span class="line"><span class="string">	&lt;body&gt; </span></span><br><span class="line"><span class="string">	  &lt;div id="</span>wrap<span class="string">"&gt;</span></span><br><span class="line"><span class="string">	  	&lt;div class="</span>inner<span class="string">"&gt;</span></span><br><span class="line"><span class="string">	  		月下Ctrlc</span></span><br><span class="line"><span class="string">	  	&lt;/div&gt;</span></span><br><span class="line"><span class="string">	  &lt;/div&gt;</span></span><br><span class="line"><span class="string">	&lt;/body&gt;</span></span><br><span class="line"><span class="string">&lt;/html&gt;</span></span><br></pre></td></tr></table></figure>
</li>
<li><p>关键帧 (定义动画的形式)<br>@keyframes animationName {</p>
<pre><code>keyframes-selector {
    CSS-style;
}</code></pre><p>}<br>animationName 定义动画的名称 必须写<br>keyframes-selector 必须写，动画持续时间的百分比 from(0%)  to(100%)<br>CSS-style  CSS声明</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br></pre></td><td class="code"><pre><span class="line">&lt;!DOCTYPE html&gt;</span><br><span class="line">&lt;html&gt;</span><br><span class="line">	&lt;head&gt;</span><br><span class="line">		&lt;meta charset=<span class="string">"utf-8"</span>&gt;</span><br><span class="line">		&lt;title&gt;&lt;<span class="regexp">/title&gt;</span></span><br><span class="line"><span class="regexp">		&lt;style type="text/</span>css<span class="string">"&gt;</span></span><br><span class="line"><span class="string">			*&#123;</span></span><br><span class="line"><span class="string">				margin: 0;</span></span><br><span class="line"><span class="string">				padding: 0;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			#wrap&#123;</span></span><br><span class="line"><span class="string">				position: absolute;</span></span><br><span class="line"><span class="string">				width: 300px;</span></span><br><span class="line"><span class="string">				height: 300px;</span></span><br><span class="line"><span class="string">				border: 1px solid;</span></span><br><span class="line"><span class="string">				top: 0;</span></span><br><span class="line"><span class="string">				right: 0;</span></span><br><span class="line"><span class="string">				bottom: 0;</span></span><br><span class="line"><span class="string">				left: 0;</span></span><br><span class="line"><span class="string">				margin: auto;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			#wrap&gt;.inner&#123;</span></span><br><span class="line"><span class="string">				position: absolute;</span></span><br><span class="line"><span class="string">				left: 50%;</span></span><br><span class="line"><span class="string">				top: 50%;</span></span><br><span class="line"><span class="string">				margin-left: -50px;</span></span><br><span class="line"><span class="string">				margin-top: -50px;</span></span><br><span class="line"><span class="string">				height: 100px;</span></span><br><span class="line"><span class="string">				width: 100px;</span></span><br><span class="line"><span class="string">				background: pink;</span></span><br><span class="line"><span class="string">				text-align: center;</span></span><br><span class="line"><span class="string">				font: 20px/100px "</span>微软雅黑<span class="string">";</span></span><br><span class="line"><span class="string">				</span></span><br><span class="line"><span class="string">				</span></span><br><span class="line"><span class="string">				animation-name: move;</span></span><br><span class="line"><span class="string">				animation-duration: 4s;</span></span><br><span class="line"><span class="string">				animation-timing-function: ease-in;</span></span><br><span class="line"><span class="string">				animation-direction: alternate;</span></span><br><span class="line"><span class="string">				animation-delay: 2s;</span></span><br><span class="line"><span class="string">				animation-iteration-count: 3;</span></span><br><span class="line"><span class="string">				animation-fill-mode: both;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			</span></span><br><span class="line"><span class="string">			@keyframes move&#123;</span></span><br><span class="line"><span class="string">				/* 百分比平分的是动画执行一次的周期animation-duration */</span></span><br><span class="line"><span class="string">				/* 运动形式animation-timing-function体现在每个区间 */</span></span><br><span class="line"><span class="string">				/* ease-in就表示没0~25，25~50等区间都是采用ease-in的运动形式 */</span></span><br><span class="line"><span class="string">				0%&#123;transform: translateY(-100px);&#125;</span></span><br><span class="line"><span class="string">				25%&#123;transform: translateY(-50px);&#125;</span></span><br><span class="line"><span class="string">				50%&#123;transform: translateY(0px);&#125;</span></span><br><span class="line"><span class="string">				100%&#123;transform: translateY(50px);&#125;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			#wrap:hover&gt;.inner&#123;</span></span><br><span class="line"><span class="string">				animation-play-state: paused;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">		&lt;/style&gt;</span></span><br><span class="line"><span class="string">	&lt;/head&gt;</span></span><br><span class="line"><span class="string">	&lt;body&gt; </span></span><br><span class="line"><span class="string">	  &lt;div id="</span>wrap<span class="string">"&gt;</span></span><br><span class="line"><span class="string">	  	&lt;div class="</span>inner<span class="string">"&gt;</span></span><br><span class="line"><span class="string">	  		月下Ctrlc</span></span><br><span class="line"><span class="string">	  	&lt;/div&gt;</span></span><br><span class="line"><span class="string">	  &lt;/div&gt;</span></span><br><span class="line"><span class="string">	&lt;/body&gt;</span></span><br><span class="line"><span class="string">&lt;/html&gt;</span></span><br></pre></td></tr></table></figure>
</li>
<li><p>应用<br>兔斯基(图片轮播)<br><img src="https://img-blog.csdnimg.cn/20200502163321310.png" alt="在这里插入图片描述"><br>使用动画依次从左到右依次展示图片，因为视觉暂留的原理，看起来就是动画</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br></pre></td><td class="code"><pre><span class="line">&lt;!DOCTYPE html&gt;</span><br><span class="line">&lt;html&gt;</span><br><span class="line">	&lt;head&gt;</span><br><span class="line">		&lt;meta charset=<span class="string">"utf-8"</span>&gt;</span><br><span class="line">		&lt;title&gt;&lt;<span class="regexp">/title&gt;</span></span><br><span class="line"><span class="regexp">		&lt;style&gt;</span></span><br><span class="line"><span class="regexp">			*&#123;</span></span><br><span class="line"><span class="regexp">				margin: 0;</span></span><br><span class="line"><span class="regexp">				padding: 0;</span></span><br><span class="line"><span class="regexp">			&#125;</span></span><br><span class="line"><span class="regexp">			html,body&#123;</span></span><br><span class="line"><span class="regexp">				height: 100%;</span></span><br><span class="line"><span class="regexp">				overflow: hidden;</span></span><br><span class="line"><span class="regexp">			&#125;</span></span><br><span class="line"><span class="regexp">			#tsj&#123;</span></span><br><span class="line"><span class="regexp">				position: absolute;</span></span><br><span class="line"><span class="regexp">				left: 50%;</span></span><br><span class="line"><span class="regexp">				top: 50%;</span></span><br><span class="line"><span class="regexp">				transform: translate(-50%,-50%);</span></span><br><span class="line"><span class="regexp">				width: 48px;</span></span><br><span class="line"><span class="regexp">				height: 48px;</span></span><br><span class="line"><span class="regexp">				background: url(01_3D&amp;动画/img</span><span class="regexp">/animation.png) no-repeat;</span></span><br><span class="line"><span class="regexp">				/</span>* start看不见第一帧，end看不见最后一帧 *<span class="regexp">/</span></span><br><span class="line"><span class="regexp">				animation: move .8s steps(12,end) infinite;</span></span><br><span class="line"><span class="regexp">			&#125;</span></span><br><span class="line"><span class="regexp">			@keyframes move&#123;</span></span><br><span class="line"><span class="regexp">				from&#123;background-position: 0 0;&#125;</span></span><br><span class="line"><span class="regexp">				to&#123;background-position: -576px 0;&#125;</span></span><br><span class="line"><span class="regexp">			&#125;</span></span><br><span class="line"><span class="regexp">		&lt;/</span>style&gt;</span><br><span class="line">	&lt;<span class="regexp">/head&gt;</span></span><br><span class="line"><span class="regexp">	&lt;body&gt;</span></span><br><span class="line"><span class="regexp">		&lt;div id="tsj"&gt;</span></span><br><span class="line"><span class="regexp">			</span></span><br><span class="line"><span class="regexp">		&lt;/</span>div&gt;</span><br><span class="line">	&lt;<span class="regexp">/body&gt;</span></span><br><span class="line"><span class="regexp">&lt;/</span>html&gt;</span><br></pre></td></tr></table></figure>

</li>
</ol>
<p>开机动画(上下跳动的文字，延迟设为不同便可实现)</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br></pre></td><td class="code"><pre><span class="line">&lt;!DOCTYPE html&gt;</span><br><span class="line">&lt;html&gt;</span><br><span class="line">	&lt;head&gt;</span><br><span class="line">		&lt;meta charset=<span class="string">"utf-8"</span>&gt;</span><br><span class="line">		&lt;!-- 移动端开发记得加这个标签 --&gt;</span><br><span class="line">		&lt;meta name=<span class="string">"viewport"</span> content=<span class="string">"width=device-width,initial-scale=1.0,user-scalable=no"</span>/&gt;</span><br><span class="line">		&lt;title&gt;&lt;<span class="regexp">/title&gt;</span></span><br><span class="line"><span class="regexp">		&lt;style type="text/</span>css<span class="string">"&gt;</span></span><br><span class="line"><span class="string">			*&#123;</span></span><br><span class="line"><span class="string">				margin: 0;</span></span><br><span class="line"><span class="string">				padding: 0;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			html,body&#123;</span></span><br><span class="line"><span class="string">				height: 100%;</span></span><br><span class="line"><span class="string">				overflow: hidden;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			#wrap&#123;</span></span><br><span class="line"><span class="string">				height: 100%;</span></span><br><span class="line"><span class="string">				background: black;</span></span><br><span class="line"><span class="string">				position: relative;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			#wrap&gt;.inner&#123;</span></span><br><span class="line"><span class="string">				position: absolute;</span></span><br><span class="line"><span class="string">				left: 50%;</span></span><br><span class="line"><span class="string">				top: 50%;</span></span><br><span class="line"><span class="string">				transform: translate(-50%,-50%);</span></span><br><span class="line"><span class="string">				white-space: nowrap;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			#wrap&gt;.inner&gt;span&#123;</span></span><br><span class="line"><span class="string">				position: relative;</span></span><br><span class="line"><span class="string">				/* animation: jump 1s linear infinite alternate; */</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			@keyframes jump&#123;</span></span><br><span class="line"><span class="string">				from&#123;top: 0px&#125;</span></span><br><span class="line"><span class="string">				to&#123;top: -12px;&#125;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">		&lt;/style&gt;</span></span><br><span class="line"><span class="string">	&lt;/head&gt;</span></span><br><span class="line"><span class="string">	&lt;body&gt;</span></span><br><span class="line"><span class="string">		&lt;div id="</span>wrap<span class="string">"&gt;</span></span><br><span class="line"><span class="string">			&lt;div class="</span>inner<span class="string">"&gt;</span></span><br><span class="line"><span class="string">				&lt;span&gt;玲&lt;/span&gt;</span></span><br><span class="line"><span class="string">				&lt;span&gt;珑&lt;/span&gt;</span></span><br><span class="line"><span class="string">				&lt;span&gt;骰&lt;/span&gt;</span></span><br><span class="line"><span class="string">				&lt;span&gt;子&lt;/span&gt;</span></span><br><span class="line"><span class="string">				&lt;span&gt;安&lt;/span&gt;</span></span><br><span class="line"><span class="string">				&lt;span&gt;红&lt;/span&gt;</span></span><br><span class="line"><span class="string">				&lt;span&gt;豆&lt;/span&gt;</span></span><br><span class="line"><span class="string">				&lt;span&gt;入&lt;/span&gt;</span></span><br><span class="line"><span class="string">				&lt;span&gt;骨&lt;/span&gt;</span></span><br><span class="line"><span class="string">				&lt;span&gt;相&lt;/span&gt;</span></span><br><span class="line"><span class="string">				&lt;span&gt;思&lt;/span&gt;</span></span><br><span class="line"><span class="string">				&lt;span&gt;知&lt;/span&gt;</span></span><br><span class="line"><span class="string">				&lt;span&gt;不&lt;/span&gt;</span></span><br><span class="line"><span class="string">				&lt;span&gt;知&lt;/span&gt;</span></span><br><span class="line"><span class="string">			&lt;/div&gt;</span></span><br><span class="line"><span class="string">		&lt;/div&gt;</span></span><br><span class="line"><span class="string">	&lt;/body&gt;</span></span><br><span class="line"><span class="string">	&lt;script type="</span>text/javascript<span class="string">"&gt;</span></span><br><span class="line"><span class="string">		window.onload = function()&#123;</span></span><br><span class="line">			var spanNodes = document.querySelectorAll("#wrap&gt;.inner&gt;span");</span><br><span class="line">			<span class="keyword">var</span> colors = [<span class="string">'red'</span>,<span class="string">'orange'</span>,<span class="string">'yellow'</span>,<span class="string">'green'</span>,<span class="string">'blue'</span>,<span class="string">'pink'</span>,<span class="string">'purple'</span>,<span class="string">'red'</span>,<span class="string">'orange'</span>,<span class="string">'yellow'</span>,<span class="string">'green'</span>,<span class="string">'blue'</span>,<span class="string">'pink'</span>,<span class="string">'purple'</span>];</span><br><span class="line">			<span class="keyword">for</span>(<span class="keyword">let</span> i = <span class="number">0</span>; i &lt; spanNodes.length; i++)&#123;</span><br><span class="line">				spanNodes[i].style.animation = <span class="string">`jump .3s <span class="subst">$&#123;i*<span class="number">50</span>&#125;</span>ms linear infinite alternate`</span>;</span><br><span class="line">				spanNodes[i].style.color = colors[i];</span><br><span class="line">			&#125;</span><br><span class="line">		&#125;</span><br><span class="line">	&lt;<span class="regexp">/script&gt;</span></span><br><span class="line"><span class="regexp">&lt;/</span>html&gt;</span><br></pre></td></tr></table></figure>

<p>开机动画(3D版本)<br>data.js里面都是本地图片的地址<br><img src="https://img-blog.csdnimg.cn/20200502164100511.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQ0NjI1MTQy,size_16,color_FFFFFF,t_70" alt="在这里插入图片描述"></p>
<p><img src="https://img-blog.csdnimg.cn/20200502163920172.png" alt="在这里插入图片描述"><br>网络在谷歌浏览器上切换<br><img src="https://img-blog.csdnimg.cn/20200502164418499.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQ0NjI1MTQy,size_16,color_FFFFFF,t_70" alt="在这里插入图片描述"></p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br></pre></td><td class="code"><pre><span class="line">&lt;!DOCTYPE html&gt;</span><br><span class="line">&lt;html&gt;</span><br><span class="line">	&lt;head&gt;</span><br><span class="line">		&lt;meta charset=<span class="string">"utf-8"</span>&gt;</span><br><span class="line">		&lt;meta name=<span class="string">"viewport"</span> content=<span class="string">"width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"</span> /&gt;</span><br><span class="line">		&lt;title&gt;&lt;<span class="regexp">/title&gt;</span></span><br><span class="line"><span class="regexp">		&lt;style type="text/</span>css<span class="string">"&gt;</span></span><br><span class="line"><span class="string">			*&#123;</span></span><br><span class="line"><span class="string">				margin: 0;</span></span><br><span class="line"><span class="string">				padding: 0;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			html,body&#123;</span></span><br><span class="line"><span class="string">				height: 100%;</span></span><br><span class="line"><span class="string">				overflow: hidden;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			#wrap&#123;</span></span><br><span class="line"><span class="string">				height: 100%;</span></span><br><span class="line"><span class="string">				position: relative;</span></span><br><span class="line"><span class="string">				perspective: 200px;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			#wrap&gt;.inner&#123;</span></span><br><span class="line"><span class="string">				position: relative;</span></span><br><span class="line"><span class="string">				left: 50%;</span></span><br><span class="line"><span class="string">				top: 50%;</span></span><br><span class="line"><span class="string">				transform: translate(-50%,-50%);</span></span><br><span class="line"><span class="string">				transform-style: preserve-3d;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			#wrap&gt;.inner&gt;img&#123;</span></span><br><span class="line"><span class="string">				width: 30%;</span></span><br><span class="line"><span class="string">				margin-top: -45px;</span></span><br><span class="line"><span class="string">				animation: xuanzhuan 2s linear infinite;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			#wrap&gt;.inner&gt;img,#wrap&gt;.inner&gt;p&#123;</span></span><br><span class="line"><span class="string">				position: absolute;</span></span><br><span class="line"><span class="string">				left: 50%;</span></span><br><span class="line"><span class="string">				top: 50%;</span></span><br><span class="line"><span class="string">				transform: translate(-50%,-50%) rotateY(0deg);</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">			@keyframes xuanzhuan&#123;</span></span><br><span class="line"><span class="string">				from&#123;transform: translate(-50%,-50%) rotateY(0deg);&#125;</span></span><br><span class="line"><span class="string">				to&#123;transform: translate(-50%,-50%) rotateY(360deg);&#125;</span></span><br><span class="line"><span class="string">			&#125;</span></span><br><span class="line"><span class="string">		&lt;/style&gt;</span></span><br><span class="line"><span class="string">	&lt;/head&gt;</span></span><br><span class="line"><span class="string">	&lt;body&gt;</span></span><br><span class="line"><span class="string">		&lt;div id="</span>wrap<span class="string">"&gt;</span></span><br><span class="line"><span class="string">			&lt;div class="</span>inner<span class="string">"&gt;</span></span><br><span class="line"><span class="string">				&lt;img src="</span>img/load/logo3.png<span class="string">" &gt;</span></span><br><span class="line"><span class="string">				&lt;p&gt;已加载0%&lt;/p&gt;</span></span><br><span class="line"><span class="string">			&lt;/div&gt;</span></span><br><span class="line"><span class="string">		&lt;/div&gt;</span></span><br><span class="line"><span class="string">	&lt;/body&gt;</span></span><br><span class="line"><span class="string">	&lt;script src="</span>js/data.js<span class="string">" type="</span>text/javascript<span class="string">" charset="</span>utf<span class="number">-8</span><span class="string">"&gt;&lt;/script&gt;</span></span><br><span class="line"><span class="string">	&lt;script type="</span>text/javascript<span class="string">"&gt;</span></span><br><span class="line"><span class="string">		window.onload = function()&#123;</span></span><br><span class="line"><span class="string">			var arr = [];</span></span><br><span class="line"><span class="string">			var flag = 0;</span></span><br><span class="line">			var pNode = document.querySelector("#wrap&gt;.inner&gt;p");</span><br><span class="line">			<span class="comment">//获取所有的图片地址链接数组</span></span><br><span class="line">			<span class="keyword">for</span>(item <span class="keyword">in</span> imgData)&#123;</span><br><span class="line">				arr = arr.concat(imgData[item]);</span><br><span class="line">			&#125;</span><br><span class="line">			<span class="comment">//模拟发ajax请求获取数据</span></span><br><span class="line">			<span class="comment">//因为图片都在本地</span></span><br><span class="line">			<span class="comment">//所以将浏览器Network conditions调为slow 3G 观看 效果才明显</span></span><br><span class="line">			<span class="keyword">for</span>(<span class="keyword">let</span> i = <span class="number">0</span>; i &lt; arr.length; i++)&#123;</span><br><span class="line">				<span class="keyword">var</span> img = <span class="keyword">new</span> Image();</span><br><span class="line">				img.src = arr[i];</span><br><span class="line">				img.onload = <span class="function"><span class="keyword">function</span>(<span class="params"></span>)</span>&#123;</span><br><span class="line">					flag++;</span><br><span class="line">					pNode.innerHTML = <span class="string">`已加载<span class="subst">$&#123;<span class="built_in">Math</span>.round(flag<span class="regexp">/arr.length*100)&#125;%`;</span></span></span></span><br><span class="line"><span class="string"><span class="subst"><span class="regexp">				&#125;</span></span></span></span><br><span class="line"><span class="string"><span class="subst"><span class="regexp">				img.onerror = function()&#123;</span></span></span></span><br><span class="line"><span class="string"><span class="subst"><span class="regexp">					console.log("加载失败!");</span></span></span></span><br><span class="line"><span class="string"><span class="subst"><span class="regexp">				&#125;</span></span></span></span><br><span class="line"><span class="string"><span class="subst"><span class="regexp">			&#125;</span></span></span></span><br><span class="line"><span class="string"><span class="subst"><span class="regexp">			/</span><span class="regexp">/ console.log(arr);</span></span></span></span><br><span class="line"><span class="string"><span class="subst"><span class="regexp">		&#125;</span></span></span></span><br><span class="line"><span class="string"><span class="subst"><span class="regexp">	&lt;/</span>script&gt;</span></span></span><br><span class="line"><span class="string"><span class="subst">&lt;<span class="regexp">/html&gt;</span></span></span></span><br></pre></td></tr></table></figure>
<p>好了，我的分享就到这里了，谢谢大家</p>

      
      <!-- reward -->
      
      <div id="reward-btn">
        打赏
      </div>
      
    </div>
    
    
      <!-- copyright -->
      
        <div class="declare">
          <ul class="post-copyright">
            <li>
              <i class="ri-copyright-line"></i>
              <strong>版权声明： </strong s>
              本博客所有文章除特别声明外，均采用 <a href="https://www.apache.org/licenses/LICENSE-2.0.html" rel="external nofollow"
                target="_blank">Apache License 2.0</a> 许可协议。转载请注明出处！
            </li>
          </ul>
        </div>
        
    <footer class="article-footer">
      
          
<div class="share-btn">
      <span class="share-sns share-outer">
        <i class="ri-share-forward-line"></i>
        分享
      </span>
      <div class="share-wrap">
        <i class="arrow"></i>
        <div class="share-icons">
          
          <a class="weibo share-sns" href="javascript:;" data-type="weibo">
            <i class="ri-weibo-fill"></i>
          </a>
          <a class="weixin share-sns wxFab" href="javascript:;" data-type="weixin">
            <i class="ri-wechat-fill"></i>
          </a>
          <a class="qq share-sns" href="javascript:;" data-type="qq">
            <i class="ri-qq-fill"></i>
          </a>
          <a class="douban share-sns" href="javascript:;" data-type="douban">
            <i class="ri-douban-line"></i>
          </a>
          <!-- <a class="qzone share-sns" href="javascript:;" data-type="qzone">
            <i class="icon icon-qzone"></i>
          </a> -->
          
          <a class="facebook share-sns" href="javascript:;" data-type="facebook">
            <i class="ri-facebook-circle-fill"></i>
          </a>
          <a class="twitter share-sns" href="javascript:;" data-type="twitter">
            <i class="ri-twitter-fill"></i>
          </a>
          <a class="google share-sns" href="javascript:;" data-type="google">
            <i class="ri-google-fill"></i>
          </a>
        </div>
      </div>
</div>

<div class="wx-share-modal">
    <a class="modal-close" href="javascript:;"><i class="ri-close-circle-line"></i></a>
    <p>扫一扫，分享到微信</p>
    <div class="wx-qrcode">
      <img src="//api.qrserver.com/v1/create-qr-code/?size=150x150&data=https://lockme.gitee.io/2020/05/14/CSS3-3D-animation-md/" alt="微信分享二维码">
    </div>
</div>

<div id="share-mask"></div>
      
      
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/3D%E5%8F%98%E6%8D%A2/" rel="tag">3D变换</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/CSS3/" rel="tag">CSS3</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/%E5%8A%A8%E7%94%BB/" rel="tag">动画</a></li></ul>


    </footer>

  </div>

  
  
  <nav class="article-nav">
    
      <a href="/2020/05/14/flex-md/" class="article-nav-link">
        <strong class="article-nav-caption">上一篇</strong>
        <div class="article-nav-title">
          
            flex.md
          
        </div>
      </a>
    
    
      <a href="/2020/05/14/CSS3-two-md/" class="article-nav-link">
        <strong class="article-nav-caption">下一篇</strong>
        <div class="article-nav-title">CSS3_two.md</div>
      </a>
    
  </nav>


  

  
  
<!-- valine评论 -->
<div id="vcomments-box">
    <div id="vcomments">
    </div>
</div>
<script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
<script src='https://cdn.jsdelivr.net/npm/valine@1.3.10/dist/Valine.min.js'></script>
<script>
    new Valine({
        el: '#vcomments',
        app_id: 'pmaQYnbUE9O0H1hiYKLiec4R-gzGzoHsz',
        app_key: 'LMujtI79W4vgEQ3Az5IMo50y',
        path: window.location.pathname,
        notify: 'false',
        verify: 'false',
        avatar: 'mp',
        placeholder: '给我的文章加点评论吧~',
        recordIP: true
    });
    const infoEle = document.querySelector('#vcomments .info');
    if (infoEle && infoEle.childNodes && infoEle.childNodes.length > 0) {
        infoEle.childNodes.forEach(function (item) {
            item.parentNode.removeChild(item);
        });
    }
</script>
<style>
    #vcomments-box {
        padding: 5px 30px;
    }

    @media screen and (max-width: 800px) {
        #vcomments-box {
            padding: 5px 0px;
        }
    }

    #vcomments-box #vcomments {
        background-color: #fff;
    }

    .v .vlist .vcard .vh {
        padding-right: 20px;
    }

    .v .vlist .vcard {
        padding-left: 10px;
    }
</style>

  

  
  
  

</article>
</section>
      <footer class="footer">
  <div class="outer">
    <ul class="list-inline">
      <li>
        &copy;
        2020
        月下ctrlc
      </li>
      <li>
        
        Powered by
        
        
        <a href="https://hexo.io" target="_blank">Hexo</a> Theme <a href="https://github.com/Shen-Yu/hexo-theme-ayer" target="_blank">Ayer</a>
        
      </li>
    </ul>
    <ul class="list-inline">
      <li>
        
        
        <span>
  <i>PV:<span id="busuanzi_value_page_pv"></span></i>
  <i>UV:<span id="busuanzi_value_site_uv"></span></i>
</span>
        
      </li>
      
      <li>
        <!-- cnzz统计 -->
        
        <script type="text/javascript" src='https://s9.cnzz.com/z_stat.php?id=1278069914&amp;web_id=1278069914'></script>
        
      </li>
    </ul>
  </div>
</footer>
      <div class="to_top">
        <div class="totop" id="totop">
  <i class="ri-arrow-up-line"></i>
</div>
      </div>
    </main>
    <aside class="sidebar">
      <button class="navbar-toggle"></button>
<nav class="navbar">
  
  <div class="logo">
    <a href="/"><img src="/images/avatar.jpg" alt="Small Bridge"></a>
  </div>
  
  <ul class="nav nav-main">
    
    <li class="nav-item">
      <a class="nav-item-link" href="/">主页</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/archives">归档</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/categories">分类</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags">标签</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags/Vue/">Vue</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="http://shenyu-vip.lofter.com" target="_blank" rel="noopener">主题作者相册</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/2020/03/18/about">关于我</a>
    </li>
    
  </ul>
</nav>
<nav class="navbar navbar-bottom">
  <ul class="nav">
    <li class="nav-item">
      
      <a class="nav-item-link nav-item-search"  title="Search">
        <i class="ri-search-line"></i>
      </a>
      
      
      <a class="nav-item-link" target="_blank" href="/atom.xml" title="RSS Feed">
        <i class="ri-rss-line"></i>
      </a>
      
    </li>
  </ul>
</nav>
<div class="search-form-wrap">
  <div class="local-search local-search-plugin">
  <input type="search" id="local-search-input" class="local-search-input" placeholder="Search...">
  <div id="local-search-result" class="local-search-result"></div>
</div>
</div>
    </aside>
    <div id="mask"></div>

<!-- #reward -->
<div id="reward">
  <span class="close"><i class="ri-close-line"></i></span>
  <p class="reward-p"><i class="ri-cup-line"></i>拿钱砸死我吧~</p>
  <div class="reward-box">
    
    <div class="reward-item">
      <img class="reward-img" src="/images/alipay.png">
      <span class="reward-type">支付宝</span>
    </div>
    
    
    <div class="reward-item">
      <img class="reward-img" src="/images/wechat.png">
      <span class="reward-type">微信</span>
    </div>
    
  </div>
</div>
    
<script src="/js/jquery-2.0.3.min.js"></script>


<script src="/js/share.js"></script>


<script src="/js/lazyload.min.js"></script>


<script>
  try {
    var typed = new Typed("#subtitle", {
      strings: ['面朝大海，春暖花开', '愿你一生努力，一生被爱', '想要的都拥有，得不到的都释怀'],
      startDelay: 0,
      typeSpeed: 200,
      loop: true,
      backSpeed: 100,
      showCursor: true
    });
  } catch (err) {
  }

</script>




<script src="/js/tocbot.min.js"></script>

<script>
  // Tocbot_v4.7.0  http://tscanlin.github.io/tocbot/
  tocbot.init({
    tocSelector: '.tocbot',
    contentSelector: '.article-entry',
    headingSelector: 'h1, h2, h3, h4, h5, h6',
    hasInnerContainers: true,
    scrollSmooth: true,
    scrollContainer: 'main',
    positionFixedSelector: '.tocbot',
    positionFixedClass: 'is-position-fixed',
    fixedSidebarOffset: 'auto',
    onClick: (e) => {
      $('.toc-link').removeClass('is-active-link');
      $(`a[href=${e.target.hash}]`).addClass('is-active-link');
      $(e.target.hash).scrollIntoView();
      return false;
    }
  });
</script>



<script src="https://cdn.jsdelivr.net/npm/jquery-modal@0.9.2/jquery.modal.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/jquery-modal@0.9.2/jquery.modal.min.css">
<script src="https://cdn.jsdelivr.net/npm/justifiedGallery@3.7.0/dist/js/jquery.justifiedGallery.min.js"></script>

<script src="/js/ayer.js"></script>



<!-- Root element of PhotoSwipe. Must have class pswp. -->
<div class="pswp" tabindex="-1" role="dialog" aria-hidden="true">

    <!-- Background of PhotoSwipe. 
         It's a separate element as animating opacity is faster than rgba(). -->
    <div class="pswp__bg"></div>

    <!-- Slides wrapper with overflow:hidden. -->
    <div class="pswp__scroll-wrap">

        <!-- Container that holds slides. 
            PhotoSwipe keeps only 3 of them in the DOM to save memory.
            Don't modify these 3 pswp__item elements, data is added later on. -->
        <div class="pswp__container">
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
        </div>

        <!-- Default (PhotoSwipeUI_Default) interface on top of sliding area. Can be changed. -->
        <div class="pswp__ui pswp__ui--hidden">

            <div class="pswp__top-bar">

                <!--  Controls are self-explanatory. Order can be changed. -->

                <div class="pswp__counter"></div>

                <button class="pswp__button pswp__button--close" title="Close (Esc)"></button>

                <button class="pswp__button pswp__button--share" style="display:none" title="Share"></button>

                <button class="pswp__button pswp__button--fs" title="Toggle fullscreen"></button>

                <button class="pswp__button pswp__button--zoom" title="Zoom in/out"></button>

                <!-- Preloader demo http://codepen.io/dimsemenov/pen/yyBWoR -->
                <!-- element will get class pswp__preloader--active when preloader is running -->
                <div class="pswp__preloader">
                    <div class="pswp__preloader__icn">
                        <div class="pswp__preloader__cut">
                            <div class="pswp__preloader__donut"></div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap">
                <div class="pswp__share-tooltip"></div>
            </div>

            <button class="pswp__button pswp__button--arrow--left" title="Previous (arrow left)">
            </button>

            <button class="pswp__button pswp__button--arrow--right" title="Next (arrow right)">
            </button>

            <div class="pswp__caption">
                <div class="pswp__caption__center"></div>
            </div>

        </div>

    </div>

</div>

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/default-skin/default-skin.css">
<script src="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe-ui-default.min.js"></script>

<script>
    function viewer_init() {
        let pswpElement = document.querySelectorAll('.pswp')[0];
        let $imgArr = document.querySelectorAll(('.article-entry img:not(.reward-img)'))

        $imgArr.forEach(($em, i) => {
            $em.onclick = () => {
                // slider展开状态
                // todo: 这样不好，后面改成状态
                if (document.querySelector('.left-col.show')) return
                let items = []
                $imgArr.forEach(($em2, i2) => {
                    let img = $em2.getAttribute('data-idx', i2)
                    let src = $em2.getAttribute('data-target') || $em2.getAttribute('src')
                    let title = $em2.getAttribute('alt')
                    // 获得原图尺寸
                    const image = new Image()
                    image.src = src
                    items.push({
                        src: src,
                        w: image.width || $em2.width,
                        h: image.height || $em2.height,
                        title: title
                    })
                })
                var gallery = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, items, {
                    index: parseInt(i)
                });
                gallery.init()
            }
        })
    }
    viewer_init()
</script>


<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
      tex2jax: {
          inlineMath: [ ['$','$'], ["\\(","\\)"]  ],
          processEscapes: true,
          skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
      }
  });

  MathJax.Hub.Queue(function() {
      var all = MathJax.Hub.getAllJax(), i;
      for(i=0; i < all.length; i += 1) {
          all[i].SourceElement().parentNode.className += ' has-jax';
      }
  });
</script>

<script src="https://cdn.jsdelivr.net/npm/mathjax@2.7.6/unpacked/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script>
  var ayerConfig = {
    mathjax: true
  }
</script>



<script src="/js/busuanzi-2.3.pure.min.js"></script>



<script type="text/javascript" src="https://js.users.51.la/20544303.js"></script>


    
  </div>
</body>

</html>